// JavaScript Document

var xmlhttp;

function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject)
	{
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}

function CheckUserNameValidate()
{
	xmlhttp = GetXmlHttpObject();
	if(xmlhttp == null)
	{
		alert("Browser do not support HTTP REQUEST");
		return;
	}
	var Username = document.getElementById("tbusername");
	var url = "xl_TaiKhoan.php?Username=" + Username;
	xmlhttp.onreadystatechange = CheckUserNameValidate_Change;
	xmlhttp.open("GET",url,true);
	xmlhttp.send("null");
}

function CheckUserNameValidate_Change()
{
	if(xmlhttp.readyState == 4)
	{
		document.getElementById("erroruser").innerHTML = xmlhttp.responseText;
	}
}